package com.ktjiaoyu.crm;

import com.ktjiaoyu.crm.pojo.User;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;

import javax.annotation.Resource;

@SpringBootTest
public class RedisTemplateTester {

    @Resource
    private StringRedisTemplate stringRedisTemplate;    //操作字符串数据

    @Resource
    private RedisTemplate<String, User> redisTemplate; //操作其他数据类型

    @Test
    public void testStringRedisTemplate(){
        stringRedisTemplate.opsForValue().set("test","123");
        String testStr = stringRedisTemplate.opsForValue().get("test");
        stringRedisTemplate.opsForValue().increment("test",1);
        System.out.println(testStr);
    }


}
